//
//  LotterysView.swift
//  MakeMoney
//
//  Created by Fan ZhiQiang on 2024/12/20.
//

import SwiftUI

struct LotterysView: View {
    let lotterys: [Lottery]
    
    var body: some View {
        List(lotterys) { lottery in
            VStack(alignment: .leading) {
                Text(lottery.dateStr)
                    .font(.title3)
                HStack {
                    HStack {
                        NumberButtonView(number: "\(lottery.front1)", color: .blue) {}
                        NumberButtonView(number: "\(lottery.front2)", color: .blue) {}
                        NumberButtonView(number: "\(lottery.front3)", color: .blue) {}
                        NumberButtonView(number: "\(lottery.front4)", color: .blue) {}
                        NumberButtonView(number: "\(lottery.front5)", color: .blue) {}
                    }
                    .padding(.trailing, 5)
                    
                    HStack {
                        NumberButtonView(number: "\(lottery.hind1)", color: .orange) {}
                        NumberButtonView(number: "\(lottery.hind2)", color: .orange) {}
                    }
                }
                HStack {
                    Text("类型:\(lottery.type)")
                        .font(.headline)
                    Spacer()
                    Text("使用第\(lottery.lotteryBall)套球")
                }
                .padding(.top, 5)
                HStack {
                    Text("前区: \(lottery.zSum.currentFront)")
                    Text("后区: \(lottery.zSum.currentHind)")
                    Text("所有: \(lottery.zSum.currentTotal)")
                }
            }
            .padding(.vertical, 5)
        }
    }
}

#Preview {
    LotterysView(lotterys: [])
}
